package com.iflytek.jcy.supervise.job.component.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author <a href=mailto:ktyi@iflytek.com>伊开堂</a>
 * @date 2021/7/2
 */
@Configuration
// @ConditionalOnClass({Redisson.class, RedissonClient.class})
@EnableConfigurationProperties({RedisProperties.class})
public class RedissonConfig {

    @Autowired
    private RedisProperties properties;

    /** 配置单节点模式 */
    // @Bean(destroyMethod = "shutdown")
    // @ConditionalOnMissingBean({RedissonClient.class})
    // @ConditionalOnSingleCandidate(RedisConnectionFactory.class)
    // public RedissonClient redissonClient() {
    //     Config config = new Config();
    //     config.useSingleServer().setAddress("redis://" + properties.getHost() + ":" + properties.getPort()).setPassword(
    //                   properties.getPassword()).setDatabase(properties.getDatabase()).setConnectionPoolSize(32)
    //           .setConnectionMinimumIdleSize(4);
    //     return Redisson.create(config);
    // }
}
